<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .content{
            width: 200px;
            height: 200px;
            border: 1px solid red;
            position: relative;
        }

        .tri{
            width: 0px;
            height: 0px;
            border: 10px solid red;
            border-color:transparent transparent transparent red;
        }

        .rec{
            width: 40px;
            height: 40px;
            border: 50px solid red;
            border-color:blue pink orange red;
            background-color: green;
        }

        /* 小小复习下水平垂直居中 定位+transform */
        .center{
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
    </style>
</head>
<body>
    <h1>使用css绘制三角形</h1>
    <div class="content">
        <div class="tri center"></div>
    </div>
    <div class="rec"></div>
</body>
</html>